<?php
require_once('conn.php');
$limit = 10;
$page = 1;
$max_page = 1;
if(isset($_REQUEST['page']) && ((int)$_REQUEST['page']) > 0)
{
	$page = $_REQUEST['page'];
}
$start = $limit*($page-1);

$data_list = array();
$query = sprintf("select * from `guanli` where `id` = %d",mysql_real_escape_string($_REQUEST['id']));
$result = mysql_query($query);
if($result == false)
	exit(sprintf("SQL ERROR %s<br>\nquery (%s)<br>\nin: <b>%s</b> at line: <b>%s</b><br>\n", mysql_error(), $query, __FILE__, __LINE__));
if($contributor = mysql_fetch_assoc($result))
{
	$query = sprintf("select n.* from `news` n where n.`addname` = '%s' and n.`BigClassName`='Column' and n.`isok` = 1 order by `addtime` desc limit %d,%d",mysql_real_escape_string($contributor['username']),$start,$limit);
	$result = mysql_query($query);
	if($result == false)
	exit(sprintf("SQL ERROR %s<br>\nquery (%s)<br>\nin: <b>%s</b> at line: <b>%s</b><br>\n", mysql_error(), $query, __FILE__, __LINE__));
	
	while($row = mysql_fetch_assoc($result))
	{
		array_push($data_list,$row);
	}
	$query = sprintf("select count(1) from `news` n where n.`addname` = '%s' and n.`BigClassName`='Column' and n.`isok` = 1",mysql_real_escape_string($contributor['username']));
	$result = mysql_query($query);
	if($result == false)
	exit(sprintf("SQL ERROR %s<br>\nquery (%s)<br>\nin: <b>%s</b> at line: <b>%s</b><br>\n", mysql_error(), $query, __FILE__, __LINE__));
	$row = mysql_fetch_row($result);
	$count = $row[0];
	$max_page = ceil($count/$limit);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> [ BIOS Monthly 作者群 ] <?php echo $contributor['username'];?>  </title>
<meta name="description" content=" " />
<meta name="KEYWORDS" CONTENT=" <?php echo $contributor['username'];?>, BIOS Monthly , 行旅 , 休閒 , 評論 , Flavor , Trend , Route , Leisure , Opinion " />

<link href="css/main.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$(".hoverFeature ,.hoverColumn,.hoverNews,.hoverEvent , .hoverRss").css("opacity","0");
		$(".hoverFeature ,.hoverColumn,.hoverNews,.hoverEvent , .hoverRss").hover(function () {
			$(this).stop().animate({
				opacity: 1
			}, "fast");
		},
		function () {
			$(this).stop().animate({
				opacity: 0
			}, "fast");
		});
		});
	</script>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>

<body onload="MM_preloadImages('images/main-btn_over_13.gif','images/main-btn_over_15.gif','images/main-btn_over_17.gif', 'images/main-btn_over_19.gif','images/feature-btn_over_01.gif','images/feature-btn_over_02.gif','images/feature-btn_over_03.gif','images/feature-btn_over_04.gif')">
<div id="all"><!-- start #all //-->
<div id="main" class="clearfix"><!-- start #main //-->
<?php include_once('top-column.php');?>
<div id="contributor-top"><!-- start #contributor-top //-->
<div id="contributor-top-photo">
  <img src="upfiles/<?php echo $contributor['images'];?>" width="300" height="400" />
  </div>
  <script language="javascript" src="js/rAlert.js"></script>
<script language="javascript">
function mail_to(id) {
		rAlert("maila.php?title=<?php echo urlencode(html_safe($info["title"]));?>&url=<?php echo urlencode(sprintf("contacta.php?id=%d",$_REQUEST['id']));?>" , null, "文章轉寄", 620, 380);
}
function addFacebook() {
 
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(window.location.href)+'&t='+encodeURIComponent('<?php echo html_safe($info['title']);?>'),'_blank');
}
</script>
  <div id="contributor-top-tab">
  <div id="contributor-top-tab1">
  <ul>
  <li><a href="#" onclick="javascript:addFacebook();return false;"><img src="images/btn-facebook.gif" width="17" height="16" /></a></li>
  <li><a href="#" onclick="javascript:mail_to(<?php printf("%d",$info["id"]);?>);return false;"><img src="images/btn-mail.gif" width="19" height="17" /></a></li>
  </ul>
</div>
<div id="contributor-top-tab2"> 
  <h3><?php echo $contributor['name'];?></h3>
</div>
<p><?php echo $contributor['content'];?></p>
<p>Blog：<a href="<?php echo $contributor['address'];?>" target="_blank"><?php echo $contributor['address'];?></a></p>
  </div>
</div><!-- end #contributor-top //-->

<div id="contact" class="clearfix"><!-- start #contact //-->

<!-- start #list-b //-->
<?php html_rend_articles_block($data_list,$page,$max_page,'','id='.$_REQUEST['id']);?>
<!-- end #list-b //-->

<?php include_once('ad-s.php');?>
</div><!-- end #contact //-->
</div><!-- end #main //-->
</div><!-- end #all //-->
<?php include_once('down.php');?>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-22189695-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</body>
</html>